Link two modules-stuck with code

Hi,

I am trying to link module m1 to module m2 based on "Source" attribute in m1 matching with "Object text" attribute in m2.

This works fine if,for example, Obj1 has"Source"= a in m1 and Obj 1 has "Obj text"= a in m2. I am facing issue when "Source" is multi lined.

For example, "Source"= a

                                       b

                                       c

It should basically,link object1 with "Source"=a\nb\nc in module M1 to obj1,obj2,obj3  IN M2 having values "Obj text" as a, b, c respectively.

i have written code for this, but i am stuck.Please see below

 

 

pragma runLim,0
Skip skp= create
Module sm=edit("...", true)
Object SRC

Module tm=edit("...", true)
Object TRG

string LinkMod="..."

for SRC in sm do
{

   for TRG in tm do
   {
      string txt= TRG."Object Text"
 put(skp,txt,TRG)
 
 if(SRC."Source"""==txt)
      {
  
         (SRC) -> LinkMod -> (TRG)
      }
      else
      {
  print identifier(SRC) " nope: SRC ["SRC."Source""] TRG ["TRG."Object Text""]\n"
      }
     
   }
}

save sm

delete skp
//close sm
//close tm


Gsquare - Thu Nov 26 07:51:20 EST 2015

Re: Link two modules-stuck with code
DoorsXLAustralia - Thu Nov 26 11:29:55 EST 2015

Maybe if you replace

 

 if(SRC."Source"""==txt)

with

 if(matches (txt, SRC."Source"""))

 

That should return true if 'txt' is contained in SRC."Source"""

 

Sean

Re: Link two modules-stuck with code
Gsquare - Fri Nov 27 00:19:23 EST 2015

DoorsXLAustralia - Thu Nov 26 11:29:55 EST 2015

Maybe if you replace

 

 if(SRC."Source"""==txt)

with

 if(matches (txt, SRC."Source"""))

 

That should return true if 'txt' is contained in SRC."Source"""

 

Sean

Hi Sean,

Worked out perfectly. Thank you so much for the quick response.

 

Gaurav